package com.moli.iov.base.util;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 判断集合和数组为空
 *
 * @author whl
 * @date 2019-09-18 12:49:08
 */
public class CollectionUtils {

  /**
   * 判断集合是否为空
   */
  public static boolean isEmpty(Collection<?> collection) {
    return collection == null || collection.isEmpty();
  }

  /**
   * 判断Map是否为空
   */
  public static boolean isEmpty(Map<?, ?> map) {
    return map == null || map.isEmpty();
  }

  /**
   * 判断数组是否为空
   */
  public static boolean isEmpty(Object[] array) {
    return array == null || array.length == 0;
  }

  /**
   * 判断List是否为空
   */
  public static boolean isEmpty(List<Object> list) {
    return list == null || list.isEmpty();
  }

  /**
   * 判断set是否为空
   */
  public static boolean isEmpty(Set<Object> set) {
    return set == null || set.isEmpty();
  }

  /**
   * 判断对象为空
   */
  public static boolean isEmpty(Object object) {
    return object == null;
  }

}
